package com.wfl.sampling.web;

import com.wfl.sampling.entity.DialogDo;
import com.wfl.sampling.entity.ShadowDo;
import com.wfl.sampling.service.ShadowService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
@RestController
@RequestMapping("/api")
public class ShadowController {
    @Resource
    private ShadowService shadowService;
    //根据用户id  获取影子列表
    @GetMapping("/shadow")
    public ArrayList<ShadowDo> getShadowByUserId(@RequestParam(name = "userId",required = true) Integer userId){
        return shadowService.getShadowByUserId(userId);
    }
    //根据影子id  获取影子对应信息
    @GetMapping("/shadowInfo")
    public ShadowDo getShadowInfoById(@RequestParam(name = "shadowId",required = true) Integer shadowId){
        return shadowService.getShadowInfoById(shadowId);
    }
    //根据影子id  修改爱好/年龄/等字段
    @PostMapping("/shadowInfo/save")
    public void saveShadowInfoById(@RequestBody ShadowDo shadowDo){
        shadowService.saveShadowInfo(shadowDo);
    }
    @PostMapping("/shadowInfo/insert")
    public void insertShadowInfoById(@RequestBody ShadowDo shadowDo){
        shadowService.insertShadowInfo(shadowDo);
    }
    //删除影子模型
    @GetMapping("/shadowInfo/delete")
    public void deleteShadowInfoById(@RequestParam(name = "shadowId",required = true) Integer shadowId){
        shadowService.deleteShadowInfo(shadowId);
    }
    //存下对话信息
    @PostMapping("/dialog/save")
    public void saveDialogById(@RequestBody DialogDo dialogDo){
        shadowService.saveDialogInfo(dialogDo);
    }
}
